package com.rayboo.example.design.pattern.command;

import java.util.ArrayList;
import java.util.List;

public class Broker {

    private List<Order> mOrders;

    public Broker() {
        mOrders = new ArrayList<>();
    }

    public void takeOrder(Order order) {
        mOrders.add(order);
    }

    public void placeOrders() {
        for(Order order : mOrders) {
            order.execute();
        }
        mOrders.clear();
    }
}
